![]() |
PATH![]() |
![]() ![]() |
The Filter reference form specifies all objects in a container that match one or more conditions specified in a Boolean expression. The Filter reference form specifies application objects only. It cannot be used to filter AppleScript objects: lists, records, or strings. For more information, see Using the Filter Reference Form.
referenceToObject ( whose | where ) Boolean
referenceToObject is a reference that specifies one or more objects.
The following are some examples of references that use the Filter reference form. For additional examples, see Using the Filter Reference Form.
The following example specifies a list of file references for all files in the Control Panels folder with file type 'APPL' .
tell application "Finder"
every file in control panels folder whose file type is "APPL"
end tell
The following example specifies all application windows that do not match a given name:
tell application "AppleWorks"
every window whose name is not "Old Report (WP)"
end tell
Except for the Every Element reference form, the application returns an error if no objects pass the test or tests. For the Every Element reference form, the application returns an empty list, {}, if no objects pass the test or tests.
To specify a container after a filter, you must enclose the filter and the reference it applies to in parentheses. For example, the parentheses around words 1 thru 5 whose first character = "M" in the following reference are required because the container of paragraph 5 follows the filter.
tell application "Finder"
(files whose file type is "APPL") in control panels folder
end tell